﻿/*****************************************************************//**
 * \file   SurgicalHapticControlRobotThread.h
 * \brief   haptic 控制机械臂线程类
 * 
 * \author Administrator
 * \date   July 2021
 * \modify by Administrator
 * \date   July 2021

 *********************************************************************/
#pragma once
#include "SurgicalRobotCommunication.h"
#include <QThread>
#include <fstream>

#include <semaphore.h>

class SurgicalHapticControlRobotThread: public QObject
{
	Q_OBJECT

public:
	SurgicalHapticControlRobotThread();
	~SurgicalHapticControlRobotThread();

public:
	SurgicalRobotCommunication* surgicalRobotCom = SurgicalRobotCommunication::GetInstance();
	bool bControlStart;

#if DEBUG_HAPTIC_CONTROL_ROBOT
	std::fstream  time_experimrnt;
#endif
public:
	//ALG 部分
	Eigen::Matrix4d m4dHapticStartposition[2], m4dHapticNewposition[2], m4dToolNewposition[2], m4dToolStartposition[2];
	Eigen::Vector3d  v3dSimgaMove;
	double dScaleFactor = 0.5;
	Eigen::Matrix3d m3dRotationSimga2robot;

public slots:
	void HapticControlRobotStart();
	void HapticControlRobotStop();

//private:
//    sem_t hHapticControlRobotSemaphore;
    void run_code();
};
